package DataConnectionInterface;

import java.io.Serializable;

import org.eclipse.swt.graphics.Image;

public class Card implements Serializable, CardInterface, Comparable {
	private static final long serialVersionUID = -2322127243523402757L;
	//private static final long serialVersionUID = 1L;
    // private Image image;
    private Integer attack;
    private Integer defense;
    private String name;
    private int waitTurns = 0;

    public Card(int attack, int defense, String name) {
        // this.image = image;
        this.attack = attack;
        this.defense = defense;
        this.name = name;
    }

    public Card(Card card) {
		// this.image = image;
		this.attack = card.getAttack();
		this.defense = card.getDefense();
		this.name = card.getName();
	}

    /*
	public Image getImage(){
        return image;
    }
	*/
    
    public Integer getAttack() {
        return attack;
    }

    public Integer getDefense() {
        return defense;
    }

    public String getName() {
        return name;
    }
    
    public void decreaseHitPoints(int damage){
    	this.defense = this.defense - damage;
    }

	@Override
	public int compareTo(Object object) {
		Card other = (Card) object;
		if(other.getAttack() > this.getAttack()) return  -1;
		if(other.getAttack() < this.getAttack()) return   1;
		else {
			if(other.getDefense() > this.getDefense()) return -1;
			if(other.getDefense() < this.getDefense()) return  1;
			else return 0;
		}
	}
	
	public int getWaitingTurns(){
		return waitTurns;
	}
	
	public void setWaitingTurns(int turns){
		this.waitTurns = turns;
	}
	
	public void decreaseWaitingTurns(){
		waitTurns--;
	}

}
